﻿using HY.Common;
using HY.Entity;
using HY.Service;
using HY.Web.Controllers;
using HY.Web.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace HY.Web.Areas.Client.Controllers
{
    public class DefaultController : BaseController
    {
        BaseService service = new BaseService();
        [AllowAnonymous]
        public ActionResult Index()
        {
            return View();
        }

        [AllowAnonymous]
        public ActionResult Detail()
        {
            return View();
        }

        [AllowAnonymous]
        public ActionResult DetailGW()
        {
            return View();
        }

        [AllowAnonymous]
        public ActionResult ContactUs()
        {
            return View();
        }

        [AllowAnonymous]
        [HttpPost]
        public ActionResult ContactUs(NeedInfo model)
        {
            ReturnModel returnModel = new ReturnModel();
            LogInfo logInfo = new LogInfo() { UserID = base.UserInfo.UserID, LogType = LogType.Insert };
            try
            {
                model.CreateUserID = base.UserInfo.UserID;
                model.CreateDate = DateTime.Now;
                returnModel.count = service.Add(model);
                returnModel.msg = "提交成功，客服人员稍后会与您联系!";
                logInfo.LogMessage = $"看仓信息提交成功";
                LogHelper.Info(logInfo);
            }
            catch (Exception ex)
            {
                returnModel = base.GetReturnModel(ex);
                returnModel.msg = "提交失败";
                logInfo.LogMessage = $"看仓信息{returnModel.msg}";
                LogHelper.Error(logInfo, ex);
            }
            return Json(returnModel);
        }

        [AllowAnonymous]
        public ActionResult Show3D()
        {
            return View();
        }
    }
}